/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Reservation_edit.java
 *
 * Created on Oct 23, 2010, 12:12:39 PM
 */

package Java;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
 *
 * @author shyan
 */


    public class CUS_RESERVATION_EDIT extends javax.swing.JFrame {
    private String url = "jdbc:oracle:thin:@localhost:1521:XE";
    private String userID = "HR";
    private String userPW = "hr";
    Statement stmt;
    Connection con;
    ResultSet rset;


    public CUS_RESERVATION_EDIT()
    {
        //super("RESERVATION");
        initComponents();
        setLocationRelativeTo(null);
        connectDatabase();
        Entity();
        //doneButton.setEnabled(false);
        ResetStatic();

    }

    //***************************** DATEBASE CONNECTION PART ******************************
    private void connectDatabase()
    {
        try
        {
            Class.forName("oracle.jdbc.OracleDriver");
            con=DriverManager.getConnection(url, userID, userPW);
        }

        catch (ClassNotFoundException ex)
        {
            Logger.getLogger(CUS_RESERVATION_EDIT.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch (SQLException ex)
        {
            Logger.getLogger(CUS_RESERVATION_EDIT.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    //***************************** DATEBASE EXECUTE PART ******************************
    private ResultSet getResultSet(String doubt)
    {
        connectDatabase();
        ResultSet outcome = null;
        try
        {
            stmt = con.createStatement();
            outcome = stmt.executeQuery(doubt);
        }
        catch (SQLException ex)
        {
            Logger.getLogger(CUS_RESERVATION_EDIT.class.getName()).log(Level.SEVERE, null, ex);
        }
        return outcome;
    }

    //***************************** DATEBASE UPDATE PART ******************************
    private void updateRow(String edit)
    {
        connectDatabase();
        try
        {
            stmt = con.createStatement();
            stmt.executeUpdate(edit);
        }
        catch (SQLException ex)
        {
            Logger.getLogger(CUS_RESERVATION_EDIT.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    // comboBox Insertion (reservation number)
    private void Entity()
    {
        comboBOX.removeAllItems();
        String SQL = "SELECT RESERVATION_NUM FROM RESERVATION ORDER BY RESERVATION_NUM ASC";

        try
        {
         rset=getResultSet(SQL);
         while (rset.next())
         {
            comboBOX.addItem(rset.getString(1));
         }
          stmt.close();
          con.close();
        }
        catch(Exception ex)
        {
           System.out.println("=.=");
        }
     }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        cancelButton = new javax.swing.JButton();
        InfoPane = new javax.swing.JPanel();
        jLayeredPane2 = new javax.swing.JLayeredPane();
        yearBox = new javax.swing.JComboBox();
        monthBox = new javax.swing.JComboBox();
        dayBox = new javax.swing.JComboBox();
        personBox = new javax.swing.JComboBox();
        paymentBox = new javax.swing.JComboBox();
        phoneField = new javax.swing.JTextField();
        nameField = new javax.swing.JTextField();
        editButton = new javax.swing.JButton();
        deleteButton = new javax.swing.JButton();
        timeBox = new javax.swing.JComboBox();
        searchLabel = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        ReserveField = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        findButton = new javax.swing.JButton();
        comboBOX = new javax.swing.JComboBox();
        Background = new javax.swing.JLabel();
        doneButton = new javax.swing.JButton();
        Background2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);

        jLabel1.setFont(new java.awt.Font("DejaVu Serif Condensed", 2, 24));
        jLabel1.setText("RESERVATION  PROFILE");
        jLabel1.setBounds(50, 0, 320, 50);
        jLayeredPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator1.setBounds(0, 50, 700, 10);
        jLayeredPane1.add(jSeparator1, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator2.setBounds(0, 434, 700, -1);
        jLayeredPane1.add(jSeparator2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        cancelButton.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        cancelButton.setText("CANCEL");
        cancelButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });
        cancelButton.setBounds(560, 450, 90, 40);
        jLayeredPane1.add(cancelButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        InfoPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        yearBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        yearBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Year", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));
        yearBox.setEnabled(false);
        yearBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                yearBoxActionPerformed(evt);
            }
        });
        yearBox.setBounds(380, 130, 80, 26);
        jLayeredPane2.add(yearBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        monthBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        monthBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Mon", "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }));
        monthBox.setEnabled(false);
        monthBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                monthBoxActionPerformed(evt);
            }
        });
        monthBox.setBounds(290, 130, 80, 26);
        jLayeredPane2.add(monthBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        dayBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        dayBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Day", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        dayBox.setEnabled(false);
        dayBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dayBoxActionPerformed(evt);
            }
        });
        dayBox.setBounds(200, 130, 80, 26);
        jLayeredPane2.add(dayBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        personBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        personBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Select...", "1", "2", "3", "4", "5", "6" }));
        personBox.setEnabled(false);
        personBox.setBounds(200, 200, 130, 26);
        jLayeredPane2.add(personBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        paymentBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        paymentBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Select..", "Cash", "Credit Card" }));
        paymentBox.setEnabled(false);
        paymentBox.setBounds(200, 230, 130, 26);
        jLayeredPane2.add(paymentBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        phoneField.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        phoneField.setFocusable(false);
        phoneField.setBounds(200, 260, 170, 26);
        jLayeredPane2.add(phoneField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        nameField.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        nameField.setFocusable(false);
        nameField.setBounds(200, 90, 170, 26);
        jLayeredPane2.add(nameField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        editButton.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        editButton.setText("EDIT");
        editButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        editButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editButtonActionPerformed(evt);
            }
        });
        editButton.setBounds(420, 300, 90, 40);
        jLayeredPane2.add(editButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        deleteButton.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 12));
        deleteButton.setText("DELETE");
        deleteButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        deleteButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteButtonActionPerformed(evt);
            }
        });
        deleteButton.setBounds(520, 300, 90, 40);
        jLayeredPane2.add(deleteButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        timeBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        timeBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Select...", "1100", "1200", "1300", "1400", "1800", "1900", "2000", "2100" }));
        timeBox.setEnabled(false);
        timeBox.setBounds(200, 170, 130, 26);
        jLayeredPane2.add(timeBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        searchLabel.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        searchLabel.setText("Search Reservation Number :");
        searchLabel.setBounds(100, 10, 200, 30);
        jLayeredPane2.add(searchLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel2.setText("Customer name :");
        jLabel2.setBounds(30, 90, 110, 30);
        jLayeredPane2.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel4.setText("Amount Of Person:");
        jLabel4.setBounds(30, 200, 160, 20);
        jLayeredPane2.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel3.setText("Date For Reservation:");
        jLabel3.setBounds(30, 130, 170, 30);
        jLayeredPane2.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel6.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel6.setText("Payment Type:");
        jLabel6.setBounds(30, 230, 120, 20);
        jLayeredPane2.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel9.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel9.setText("Phone Number:");
        jLabel9.setBounds(30, 260, 130, 30);
        jLayeredPane2.add(jLabel9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel7.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel7.setText("Reservation no. :");
        jLabel7.setBounds(30, 50, 110, 40);
        jLayeredPane2.add(jLabel7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        ReserveField.setFont(new java.awt.Font("DejaVu Serif Condensed", 2, 14));
        ReserveField.setBounds(200, 60, 90, 20);
        jLayeredPane2.add(ReserveField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel5.setText("Time For Reservation:");
        jLabel5.setBounds(30, 170, 150, 20);
        jLayeredPane2.add(jLabel5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        findButton.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        findButton.setText("FIND");
        findButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findButtonActionPerformed(evt);
            }
        });
        findButton.setBounds(420, 10, 70, 30);
        jLayeredPane2.add(findButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        comboBOX.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        comboBOX.setBounds(310, 10, 100, 30);
        jLayeredPane2.add(comboBOX, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/abstract_0072.jpg"))); // NOI18N
        Background.setBounds(0, 0, 640, 360);
        jLayeredPane2.add(Background, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout InfoPaneLayout = new javax.swing.GroupLayout(InfoPane);
        InfoPane.setLayout(InfoPaneLayout);
        InfoPaneLayout.setHorizontalGroup(
            InfoPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
        );
        InfoPaneLayout.setVerticalGroup(
            InfoPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE)
        );

        InfoPane.setBounds(40, 60, 630, 360);
        jLayeredPane1.add(InfoPane, javax.swing.JLayeredPane.DEFAULT_LAYER);

        doneButton.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        doneButton.setText("DONE");
        doneButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        doneButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                doneButtonActionPerformed(evt);
            }
        });
        doneButton.setBounds(460, 450, 90, 40);
        jLayeredPane1.add(doneButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Background2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/abstract2.jpg"))); // NOI18N
        Background2.setText("jLabel10");
        Background2.setBounds(0, 0, 700, 500);
        jLayeredPane1.add(Background2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 700, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void monthBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_monthBoxActionPerformed

    private void dayBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dayBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_dayBoxActionPerformed

    private void yearBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yearBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_yearBoxActionPerformed

    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        this.setVisible(false);
        new EMPLOYEE_MENU().setVisible(true);
    }//GEN-LAST:event_cancelButtonActionPerformed

    private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneButtonActionPerformed
        
        String Rnum = ReserveField.getText().toString();
        String name = nameField.getText();
        String day  = dayBox.getSelectedItem().toString();
        String month= monthBox.getSelectedItem().toString();
        String year = yearBox.getSelectedItem().toString();
        String date = day+month+year;
        String time = timeBox.getSelectedItem().toString();
        String numOFperson = personBox.getSelectedItem().toString();
        String paymentType = paymentBox.getSelectedItem().toString();
        String cusPhone    = phoneField.getText();

        String editQuery="UPDATE RESERVATION SET CUS_NAME='"+name+"',RESERVATION_DATE='"+date+"',"
                + "RESERVATION_TIME='"+time+"',CUS_PHONENUM='"+cusPhone+"',NUM_OF_PERSON='"+numOFperson+"',"
                + "PAYMENT_TYPE='"+paymentType+"' WHERE RESERVATION_NUM='"+Rnum+"'";
        
        System.out.println(editQuery);
        String message="Do you want to save the changes ?";
        String title = "Confirmation?";
        int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION)
        {
            try
            {
                updateRow(editQuery);
                JOptionPane.showMessageDialog(null, "Update successful.");
                ResetStatic();
                //this.setVisible(false);
                //new EMPLOYEE_MENU().setVisible(true);
            }
            catch(Exception ex)
            {
                JOptionPane.showMessageDialog(null, "Update failed.");
                ex.printStackTrace();
            }
        }
       
    }//GEN-LAST:event_doneButtonActionPerformed



    private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
        
        if(nameField.getText().equals(""))
        {
            JOptionPane.showMessageDialog(null, "PLease find the reservation first !");
        }
        else
        {
            nameField.setEnabled(true);
            dayBox.setEnabled(true);
            monthBox.setEnabled(true);
            yearBox.setEnabled(true);
            timeBox.setEnabled(true);
            personBox.setEnabled(true);
            paymentBox.setEnabled(true);
            phoneField.setEnabled(true);

            nameField.setFocusable(true);
            phoneField.setFocusable(true);

            editButton.setEnabled(false);
            doneButton.setVisible(true);
            doneButton.setEnabled(true);
            deleteButton.setEnabled(false);
        }
           
    }//GEN-LAST:event_editButtonActionPerformed

    // SEARCH RESERVATION --------------------------------------------------------
    private void findButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findButtonActionPerformed
        String m=comboBOX.getSelectedItem().toString();
        String Query="SELECT * FROM RESERVATION WHERE RESERVATION_NUM="+m;

        try
        {
          rset=getResultSet(Query);
          if(rset.next())
          {
              ReserveField.setText(m);
              nameField.setText(rset.getString("CUS_NAME"));

                String ReserveDate = rset.getString("RESERVATION_DATE");
                yearBox.setSelectedItem(ReserveDate.substring(0,4));
                String Month = ReserveDate.substring(5,7);
                if (Month.equals("01"))
                    monthBox.setSelectedItem("Jan");
                else if(Month.equals("02"))
                    monthBox.setSelectedItem("Feb");
                else if(Month.equals("03"))
                    monthBox.setSelectedItem("Mar");
                else if(Month.equals("04"))
                    monthBox.setSelectedItem("Apr");
                else if(Month.equals("05"))
                    monthBox.setSelectedItem("May");
                else if(Month.equals("06"))
                    monthBox.setSelectedItem("June");
                else if(Month.equals("07"))
                    monthBox.setSelectedItem("July");
                else if(Month.equals("08"))
                    monthBox.setSelectedItem("Aug");
                else if(Month.equals("09"))
                    monthBox.setSelectedItem("Sep");
                else if(Month.equals("10"))
                    monthBox.setSelectedItem("Oct");
                else if(Month.equals("11"))
                    monthBox.setSelectedItem("Nov");
                else
                    monthBox.setSelectedItem("Dec");

                dayBox.setSelectedItem(ReserveDate.substring(8,10));

              timeBox.setSelectedItem(rset.getString("RESERVATION_TIME"));
              personBox.setSelectedItem(rset.getString("NUM_OF_PERSON"));
              paymentBox.setSelectedItem(rset.getString("PAYMENT_TYPE"));
              phoneField.setText(rset.getString("CUS_PHONENUM"));
          }

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }

        editButton.setEnabled(true);
        deleteButton.setEnabled(true);
        ReserveField.setFocusable(false);
        nameField.setFocusable(false);
        dayBox.setEnabled(false);
        monthBox.setEnabled(false);
        yearBox.setEnabled(false);
        timeBox.setEnabled(false);
        personBox.setEnabled(false);
        paymentBox.setEnabled(false);

        

    }//GEN-LAST:event_findButtonActionPerformed

    private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed

        String Rnum = ReserveField.getText().toString();
        String deleteQuery="DELETE FROM RESERVATION WHERE RESERVATION_NUM="+Rnum;
        System.out.println(deleteQuery);
        String message="Do you want to remove this reservation ?";
        String title = "Confirmation?";
        int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION)
        {
            try
            {
                updateRow(deleteQuery);
                JOptionPane.showMessageDialog(null, "Delete successful.");
                ResetStatic();
                Entity();
            }
            catch(Exception ex)
            {
                JOptionPane.showMessageDialog(null, "Delete failed.");
                ex.printStackTrace();
            }
        }


    }//GEN-LAST:event_deleteButtonActionPerformed
    //--------------------------------------------------------------------------
    
    
    private void ResetStatic()
    {
        ReserveField.setText("");
        nameField.setText("");
        dayBox.setSelectedIndex(0);
        monthBox.setSelectedIndex(0);
        yearBox.setSelectedIndex(0);
        timeBox.setSelectedIndex(0);
        phoneField.setText("");
        personBox.setSelectedIndex(0);
        paymentBox.setSelectedIndex(0);

        doneButton.setEnabled(false);
        deleteButton.setEnabled(false);
        editButton.setEnabled(false);
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                    new CUS_RESERVATION_EDIT().setVisible(true);
  
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Background;
    private javax.swing.JLabel Background2;
    private javax.swing.JPanel InfoPane;
    private javax.swing.JLabel ReserveField;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton cancelButton;
    private javax.swing.JComboBox comboBOX;
    private javax.swing.JComboBox dayBox;
    private javax.swing.JButton deleteButton;
    private javax.swing.JButton doneButton;
    private javax.swing.JButton editButton;
    private javax.swing.JButton findButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLayeredPane jLayeredPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JComboBox monthBox;
    private javax.swing.JTextField nameField;
    private javax.swing.JComboBox paymentBox;
    private javax.swing.JComboBox personBox;
    private javax.swing.JTextField phoneField;
    private javax.swing.JLabel searchLabel;
    private javax.swing.JComboBox timeBox;
    private javax.swing.JComboBox yearBox;
    // End of variables declaration//GEN-END:variables

}
